<?php
require('./lib/init.php');

//查询所有的栏目
$sql = "select * from cat";
$cats = mGetAll($sql);
//var_dump($cats);

//当你点击了右侧的栏目,左侧应该输出栏目相应的文章
if(isset($_GET['cat_id'])){
	$where = " and art.cat_id=$_GET[cat_id]";
}else{
	$where = '';
}

//判断当前页码数
$page = isset($_GET['page'])?$_GET['page']:1;
$per = 2;
$limit = ' limit '.($page-1)*$per.','.$per;
//echo $limit;
$pages = pagenation(13,2,$page);

//左侧文章列表
$sql = "select art.*,cat.catname from art inner join cat on art.cat_id=cat.cat_id".$where.$limit;
$arts = mGetAll($sql);
//print_r($arts);

require (ROOT.'/view/front/index.html');
 ?>